import React from 'react';
import { Tooltip } from 'antd';
import CommonList from '../../../components/CommonLists/list';

class UserList extends CommonList {
  constructor(props) {
    super(props);
    this.api = 'allUser';
    this.needOperateColumn = false

    this.columns = [
      {
        title: '用户名',
        key: 'username',
        dataIndex: 'username',
        render: (text) => {
          return (
            <Tooltip title={text} placement='topLeft'>
              {text}
            </Tooltip>
          );
        },
      },
      {
        title: '员工姓名',
        key: 'name',
        dataIndex: 'name',
        render: (text) => {
          return (
            <Tooltip title={text} placement='topLeft'>
              {text}
            </Tooltip>
          );
        },
      },
      {
        title: '角色',
        key: 'roles',
        dataIndex: 'roles',
        render: (text, record) => {
          return (
            <Tooltip title={text.join(',')}>
              {text.join(',')}
            </Tooltip>
          );
        },
      },
      {
        title: '所属部门',
        key: 'dept_name',
        dataIndex: 'dept_name',
        render: (text) => {
          return (
            <Tooltip title={text} placement='topLeft'>
              {text}
            </Tooltip>
          );
        },
      },
      {
        title: '渠道权限',
        key: 'app_ids',
        dataIndex: 'app_ids',
        render: (text, record) => {
          return (
            <Tooltip title={text && text.join(',')}>
              {text && text.join(',')}
            </Tooltip>
          );
        },
      },
      {
        title: '邮箱',
        dataIndex: 'email',
        key: 'email',
        render: (text) => {
          return (
            <Tooltip title={text} placement='topLeft'>
              {text}
            </Tooltip>
          );
        },
      },
      {
        title: '手机号',
        dataIndex: 'mobile',
        key: 'mobile',
        render: (text) => {
          return (
            <Tooltip title={text} placement='topLeft'>
              {text}
            </Tooltip>
          );
        },
      },
      {
        title: '备注',
        dataIndex: 'remark',
        key: 'remark',
        render: (text) => {
          return (
            <Tooltip title={text} placement='topLeft'>
              <div>{text}</div>
            </Tooltip>
          );
        },
      },
      {
        title: '创建者',
        dataIndex: 'create_by',
        key: 'create_by',
        render: (text) => {
          return (
            <Tooltip title={text} placement='topLeft'>
              {text}
            </Tooltip>
          );
        },
      },
      {
        title: '创建时间',
        dataIndex: 'create_at',
        key: 'create_at',
        width: 150,
        render: (text) => {
          return (
            <Tooltip title={text} placement='topLeft'>
              <div>{text}</div>
            </Tooltip>
          );
        },
      },
    ];
  }
}

export default UserList;
